#pragma once

#include "base/Bytes.h"

#include "protocol/transport.pb.h"
#include "broker/server/BrokerMediator.h"
#include <map>
#include <optional>

namespace zeroplus::mq
{
    class BrokerMediator;
    class AbstractRequestService
    {
    protected:
        std::shared_ptr<BrokerMediator> mediator_;

    public:
        AbstractRequestService(std::shared_ptr<BrokerMediator> mediator) : mediator_(mediator) {}
        virtual ~AbstractRequestService() = default;
        virtual std::optional<transport::ReplyCommand> ProcessRequest(const transport::RequestCommand &requestCmd) = 0;
        virtual void InternalSend(const Bytes &data)
        {
            LOG_FATAL("not impl yet");
        }
        virtual void InternalReceive(const ServiceType &sender, const Bytes &data)
        {
            LOG_FATAL("not impl yet");
        }
    };
} // namespace zeroplus::mq
